#include<sstream>
#include"ros/ros.h"
#include"std_msgs/Float32.h"
#include"test_sensor/sensor2d.h"
#include<armadillo>
using namespace arma;
int main(int argc,char **argv)
{
    ros::init(argc,argv,"test_sensor_talker");
    ros::NodeHandle n;
    ros::Publisher chatter_pub = n.advertise<test_sensor::sensor2d>("sensor001",1000);
    ros::Rate loop_rate(10);
    int count =0;
    //arma test
      cout << "Armadillo version: " << arma_version::as_string() << endl;
  
  // construct a matrix according to given size and form of element initialisation
  mat A(2,3,fill::zeros);
  // .n_rows and .n_cols are read only
  cout << "A.n_rows: " << A.n_rows << endl;
  cout << "A.n_cols: " << A.n_cols << endl;

    while(ros::ok())
    {
        test_sensor::sensor2d msg;
        //数据生成
        float ss=(float)count;
        msg.time=ss;
        msg.pos_x=0;
        msg.pos_y=0;
        msg.r=100;
        msg.theta=0.5;
 	   // ROS_INFO("%0.2f",msg);
         chatter_pub.publish(msg);
         ros::spinOnce();
         loop_rate.sleep();
         count++;
	//count=count%10;
    }
    return 0;
}
